package com.woniu.service.healthSystem.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniu.mapper.healthSystem.UserMapperGb;
import com.woniu.model.healthSystem.entity.User;
import com.woniu.service.healthSystem.IUserServiceGb;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 用户表 服务实现类
 * </p>
 *
 * @author gb
 * @since 2023-10-19
 */
@Service
public class UserServiceImplGb extends ServiceImpl<UserMapperGb, User> implements IUserServiceGb {

    @Autowired
    private UserMapperGb userMapperGb;


    /**
     * 多条件分页查询
     *
     * @param condition
     * @param pageNum
     * @param pageSize
     */
    @Override
    public PageInfo<User> findByPage(Map<String, Object> condition, int pageNum, int pageSize) {
            PageHelper.startPage(pageNum,pageSize);
            List<User> list = userMapperGb.findAll(condition);
            return new PageInfo<>(list);

    }

    /**
     * 通过id查询
     *
     * @param id
     */
    @Override
    public User findById(Long id) {
        return userMapperGb.findById(id);
    }
}
